<!-- TWO STEPS TO INSTALL VALIDATION: 1. Paste the coding into the HEAD of your HTML document 2. Put the last code into the BODY of your HTML document --> <!-- STEP ONE: Copy this code into the HEAD of your HTML document --> <HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- This script and many more are available online from --> <!-- The JavaScript Source!! http://javascriptsource.com --> <!-- Begin function everything(form) { isName(form) isEmail(form) isHomepage(form) isComments(form) allblanks(form) } function allblanks(form) { if((isName(form) && isEmail(form)) && (isHomepage(form) && isComments(form))) { form.submit() } if((isName(form) == false || isEmail(form) == false) || (isHomepage(form) == false || isComments(form) == false)) { compose(form) } } function compose(form) { var text = "You forgot to fill in correctly:" if(isName(form) == false) { text += "\nyour name" } if(isEmail(form) == false) { text += "\nyour e-mail address" } if(isHomepage(form) == false) { text += "\nyour homepage's url" } if (isComments(form) == false) { text += "\nyour comments" } alert(text) } function isName(form) { if (form.yourname.value == "") { return false } else { return true } } function isEmail(form) { if ((form.email.value == "" || form.email.value.indexOf('@', 0) == -1) || form.email.value.indexOf('.') == -1) { return false } else { return true } } function isHomepage(form) { if ((form.homepage.value == "" || form.homepage.value.indexOf("http://") == -1) || form.homepage.value.indexOf(".") == -1) { return false } else { return true } } function isComments(form) { if(form.cs.value == "") { return false } else { return true } } // End --> </SCRIPT> <!-- STEP TWO: Copy this code into the BODY of your HTML document --> <BODY> <CENTER> <FORM name="kurt" method="post" action="mailto:youremailaddress?subject=Form"> <dl> <p> <dt>Name: <dd><input type="text" value="" name="yourname" size=30> </p> <p> <dt>E-mail: <dd><input type="text" value="" name="email" size=30> </p> <p> <dt>Your homepage: (begin with http://) <dd><input type="text" value="http://" name="homepage" size=60> </p> <p> <dt>Suggestion(s)/Comment(s) <dd><textarea rows=7 cols=60 name="cs"></textarea> </p> </dl> <input type="button" name="thesubmit" value="Submit" onClick="everything(this.form)"> <input type="reset" value="Reset"> </FORM> <!-- Script Size: 2.47 KB -->
1998 Copyright (C) Next Step Software All Rights Reserved